<template>
  <div class='meeting-paper'>
    <div id="editor"></div>
    <div class="file-list">
      <el-upload class="upload-demo" :action="uploadUrl" accept=".xls,.xlsx,.zip,.rar,.doc,.docx"  :file-list="fileList" :multiple='false' :limit="1">
        <el-button disabled size="small" type="primary" title="上传会议附件">点击上传附件</el-button>
        <div slot="tip" class="el-upload__tip">干哈</div>
      </el-upload>
    </div>
  </div>
</template>
<script>
export default {
  components: {},
  name: "",
  data() {
    return {
      editor: null,
      uploadUrl:PATH+'answer/importFile.do',
      fileList:[
        // {name:"",url:''}
      ],//上传文件列表
    };
  },
  methods: {
    // 获取富文本内容
    getContent() {
      var content = this.editor.txt.html();
    },
    setContent(html) {
      this.editor.txt.html(html);
    }
  },
  created() {},
  mounted() {
    var that=this
    var E = window.wangEditor;
    this.editor = new E("#editor");
    // 配置上传图片地址
    this.editor.customConfig.uploadImgServer = picPath;

    this.editor.customConfig.onblur = function(html) {
      // html 即编辑器中的内容
      that.$store.state.add.info.meetingFile=html
    };
    this.editor.create();

    this.$nextTick(()=>{
      this.setContent(that.$store.state.records.meetingInfo.material)
      if(this.$store.state.records.meetingInfo.materialUrl){
        this.fileList=[
          {
            name:this.$store.state.records.meetingInfo.fileName||'附件',
            url:this.$store.state.records.meetingInfo.materialUrl
          }
        ]
      }
    })
  }
};
</script>
<style lang="scss" scoped>
.meeting-paper {
  padding: 15px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;

  #editor {
    height: 60%;
    // flex-grow: 1
  }
  .file-list{
    padding-top: 15px;
  }
}
</style>